package com.cloudfun.campusshare.device.protocol.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by Huqin on 2019/12/21
 */
@Configuration
public class IotClientConfig {

    @Value("${aliyun.accessKey}")
    private String accessKey;

    @Value("${aliyun.accessKeySecret}")
    private String accessSecret;

    private static final String regionId = "cn-shanghai";

    @Bean
    public IAcsClient iAcsClient() throws Exception {
        //设置client的参数
        IClientProfile profile = DefaultProfile.getProfile(regionId, accessKey, accessSecret);
        return new DefaultAcsClient(profile);
    }

}
